/****** Object:  StoredProcedure [dbo].[sp_AirHAWBReport]    Script Date: 10/10/2013 13:31:07 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sp_AirMAWBReport]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[sp_AirMAWBReport]
GO
/****** Object:  StoredProcedure [dbo].[sp_AirHAWBReport]    Script Date: 10/10/2013 13:31:07 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

-- =============================================
-- Author:		<Tuan Chau>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[sp_AirMAWBReport]
	-- Add the parameters for the stored procedure here
	@JobNo nvarchar(100)
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;
	
    -- Insert statements for procedure here
	Select 
	--U_HAWBNo
	U_AWBNo
	,U_ShipperNameAddress
	,U_ConsigneeNameAddr
	,U_CarrierAgnetName
	,U_CarrierAgnetCity
	,T0.U_JobNo
	,U_CarrierAgnetIATA
	,U_ConsigneeAccNum
	,U_LoadPortCC
	,T1.U_Destination
	,U_FlighDate
	,U_Route1
	,U_CarrierC
	,U_Route2
	,U_Route3
	,U_Currecy
	,U_WTPPC
	,U_WTCOLL
	,U_OtherPPC
	,U_OtherCOLL
	,U_ValueforCarriage
	,U_ValueforCustoms
	,U_DisPortCC
	,U_AmountofInsuranc
	,U_Requirments
	,U_Pieces
	,U_GrWeight
	,U_K_I
	,U_RC
	,U_ChWeight
	,U_RateClss
	,U_Total
	,U_NatQty	
From
	[@AB_AIRE_JOB_H] T0
	Left Join [@AB_AWB_M] T1 on T0.U_JobNo = T1.U_JobNo
	Left Join [@AB_AWB_M1] T2 on T1.DocEntry = T2.DocEntry
	Left Join [@AB_AWB_M2] T3 on T1.DocEntry = T3.DocEntry
	Left Join [@AB_AWB_M3] T4 on T1.DocEntry = T3.DocEntry
Where
	T0.U_JobNo = @JobNo
END

GO


